import sdk from '../core';
import { BaseConnection } from "tsrpc";
import component, { ComType } from "../core/tool/component";
import common from "../core/tool/common";
import { wordCell, wordMap } from "../core/rpg/wordMap";
import { mathType } from "../core/tool/face";
import { analysisIntent, baseScene } from "../core/tool/baseScene";
// import { analysisIntent } from "../tool/baseScene";
// import { mathType } from "../face";
// import rpg_component from "./rpg_component";
// import PropManage from "../lib/PropManage";
// import client_component from "./client_component";
// import enemy from "../rpg/entity/enemy";
// import create_component from "./create_component";
// import bag_component from "./bag_component";
// import { 资源枚举, 道具枚举, ItemType } from "../shared/face/enums";
// import { PositionService } from "../service/PositionService";

/**
 * 位置组件 - 只负责位置数据和状态管理
 * 职责：
 * 1. 管理场景和地图状态
 * 2. 存储和维护玩家在地图中的位置
 */
export default class pos_component extends component {
    sceneName: string = 'default';
    _map?: wordMap;
    _cell?: wordCell;

    constructor() {
        super();
    }

    init() {
        // 注册位置指令
        this.registerIntent(mathType.完全匹配, '位置', this.client_position, false);
    }

    // 位置指令处理
    client_position(data: analysisIntent) {
        // 获取当前场景并调用其handlePosition方法
        const com_pos = data.player.getComponent(ComType.位置) as pos_component;
        const scene = sdk.scene.getScene(com_pos.sceneName) as baseScene;
        scene.onPosition(data);

    }

    // 只保留位置相关的底层方法（如有需要可补充）
}

